<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>时钟</title>
		<style type="text/css">
			div{
				width: 550px;
				height: 300px;
				border: 1px #000000 solid;
			}
		</style>
	</head>
	<body>
		<div id="myclock"></div>
		
		<script type="text/javascript">
			function clockh(){
				var today = new Date();
				var year = today.getFullYear();
				var month = today.getMonth();
				var day = today.getDate();
				var xinqi = today.getDay();
				var zhou ;
				switch(xinqi){
					case 0:
					zhou = "星期日";
					break;
					case 1:
					zhou = "星期一";
					
					break;
					case 2:
					zhou = "星期二";
					
					break;
					case 3:
					zhou = "星期三";
					
					break;
					case 4:
					zhou = "星期四";
					
					break;
					case 5:
					zhou = "星期五";
					
					break;
					case 6:
					zhou = "星期六";
					
					break;
					
					
					
				}
				var hours = today.getHours();
				var minutes = today.getMinutes();
				var second = today.getSeconds();
				var spm ;
				if(hours>12){
					spm = "PM";
				}
				else{
					spm = "SM";
				}
				document.getElementById("myclock").innerHTML="你好，欢迎访问贵美商城！"
				+"\n" + year + "年" +(month+1)+ "月"+ day+ "日"+"   " + hours +":"+minutes + ":"+second + "   "+spm+"   "+zhou
			}
			
				var myTime = setInterval("clockh()",1000);
				
		</script>
	</body>
</html>
